package com.oneandseven.dajia.utils;

public class StrUtil {
    public static int countWords(String text) {
        text = text.toLowerCase();
        String punctuation = "!()-[]{};:'\"\\,<>./?@#$%^&*_~";
        for (char c : punctuation.toCharArray()) {
            text = text.replace(String.valueOf(c), "");
        }
        String[] words = text.split("\\s+");
        return words.length;
    }
}
